import request from '@/sheep/request';
import $platform from '@/sheep/platform';

export default {
  profile: () =>
    request({
      url: 'user.user/profile',
      method: 'GET',
      custom: {
        auth: true,
      },
    }),
 
  // 添加分享记录
  addShareLog: (data) =>
    request({
      url: 'share/add',
      method: 'POST',
      data,
      custom: {
        showError: false,
      },
    }),
  share: {
    list: (params) =>
      request({
        url: 'share',
        method: 'GET',
        params,
      }),
  },
 

  // 账号登录
  accountLogin: (data) =>
    request({
      url: 'user.user/accountLogin',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '登录中',
      },
    }),
  // 账号登出
  logout: (data) =>
    request({
      url: 'user.user/logout',
      method: 'POST',
      data,
    }),
  // 账号注销
  logoff: (data) =>
    request({
      url: 'user.user/logoff',
      method: 'POST',
      data,
    }),
  //实名认证
  account: {
    info: (params) =>
      request({
        url: 'user.account',
        method: 'GET',
        params,
        custom: {
          showError: false,
          auth: true,
        },
      }),
    save: (data) =>
      request({
        url: 'user.account/save',
        method: 'POST',
        data,
        custom: {
          showSuccess: true,
          auth: true,
        },
      }),
    username: (data) =>
      request({
        url: 'api/user/authentication',
        method: 'POST',
        data,
        custom: {
          auth: true,
          showSuccess: true,
        },
      }),

  },
  // 用户：入职申请接口
  userAdd: (data) => 
    request({
      url:'/api/entry_info/add',
      method:'POST',
      custom:{
        auth: true,
        showSuccess: false
      },
      data
    }),
   // 入职申请（2-个人签字）
   enrollmentSignature: (params) => 
    request({
      url:'/api/entry_info/enrollment_signature',
      method:'POST',
      custom:{
        auth: true,
        showSuccess: false
      },
      params
    }),
     // 入职申请（3-请求劳务合同）
     requestContact: (data) => 
    request({
      url:'/api/entry_info/request_contract',
      method:'POST',
      custom:{
        auth: true,
        showSuccess: false
      },
      data
    }),
   // 入职申请（4-合同签字）
   contactSignature: (data) => 
    request({
      url:'/api/entry_info/contact_signature',
      method:'POST',
      custom:{
        auth: true,
        showSuccess: false
      },
      data
    }),
      // 入职申请（4-合同签字）
  getUserGroup: (data) => 
    request({
      url:'/api/user/getUserGroup',
      method:'POST',
      custom:{
        auth: true,
        showSuccess: false
      },
      data
    }),
  
  // 获取用户实名认证信息
  get_user_authenticationAPI: () =>
    request({
      url: 'api/user/get_user_authentication',
      method: 'GET',
      custom: {
        showError: false,
        auth: true,
      },
    }),


  reimburseAdd: (data) =>
    request({
      url: 'api/reimburse/add',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        auth: true,
      },
    }),
  // 短信登录
  smsLogin: (data) =>
    request({
      url: 'user.user/smsLogin',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '登录中',
      },
    }),
  // 短信注册
  smsRegister: (data) =>
    request({
      url: 'user.user/smsRegister',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '正在注册',
      },
    }),
  //绑定手机号 更新客户资料接口
  postUpdateCustomerProfile: (data) =>
  request({
    url: 'user.user/update',
    method: 'POST',
    custom: {
      auth: true,
    },
    data,
  }),
  // 更新小程序信息
  updateMpUserInfo: (data) =>
    request({
      url: 'user.user/updateMpUserInfo',
      method: 'POST',
      data,
    }),

  // 第三方授权信息
  thirdOauthInfo: () =>
    request({
      url: 'user.user/thirdOauth',
      method: 'GET',
      params: {
        provider: $platform.provider,
        platform: $platform.platform,
      },
      custom: {
        showLoading: false,
      },
    }),

    // 更新用户资料
    userUpdate: (data) => 
    request({
      url: '/addons/shopro/user.user/update',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        auth: true,
      }
    }),

    // 获取用户信息
    userProfile: () => 
    request({
      url: '/addons/shopro/user.user/profile',
      method: 'GET',
      custom: {
        showSuccess: false,
        auth: true,
      }
    }),
    
    // 用户：获取全部员工
    getEntryStaff:(params) =>
    request({
      url:'/api/user/getEntryStaff',
      method:'GET',
      custom:{
        auth:true,
        showLoading:true,
        showSuccess: false,
        showError: true
      },
      params
    }),
    // 用户：获取员工详情
    getEntryStaffDetail:(params) =>
      request({
        url:'/api/user/getEntryStaffDetail',
        method:'GET',
        params,
        custom:{
          auth:true,
          showLoading:true,
          showSuccess: false,
          showError: false
        },
      }),
      // 获取员工列表
      getEntryStaffAllAPI:(params) =>
      request({
        url:'/api/user/getEntryStaff',
        method:'GET',
        params,
        custom:{
          auth:true,
          showLoading:true,
          showSuccess: false,
          showError: false
        },
      }),

  // 用户：获取用户是否入职
  getUserEntry:() => 
    request({
      url:'/api/entry_info/get_user_isjoin',
      method:'GET',
      custom:{
        showSuccess: false,
        successMsg: '',
        showError: true,
        errorMsg: '',
        showLoading: false,
        loadingMsg: '加载中',
        auth: true,
      },
    }),

    // 用户：获取全部员工
    UsergetGroupUserByShareId:(params) =>
      request({
        url:'api/user/getGroupUserByShareId',
        method:'GET',
        custom:{
          auth:true,
          showLoading:true,
          showSuccess: false,
          showError: true
        },
        params
      }),
}
